package org.csu.chatserver.entity.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import org.csu.chatserver.entity.dto.SingleMsgDTO;

@Data
public class SingleMessage {
    @TableId(type = IdType.AUTO) // 关键配置
    String id;
    private String time;
    private int senderId;
    private int targetId;
    private String content;
    @TableField("is_read")
    private boolean isRead;

    public SingleMessage(String time, SingleMsgDTO singleMsgDTO) {
        this.time = time;
        this.senderId = singleMsgDTO.getSenderId();
        this.targetId = singleMsgDTO.getTargetId();
        this.content = singleMsgDTO.getContent();
        isRead = false;
    }
}
